package cn.cas.mango.util.paramCheck;

import cn.cas.mango.dto.param.HotSpotNewsParam;
import cn.cas.mango.service.ConfigService;
import cn.cas.mango.util.string.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;

@Service
@Slf4j
public class HotListDetailParamCheckUtil {
  @Autowired
  private ConfigService configService;
  public void check(HotSpotNewsParam param) {

    if(param.getProvince() == null) {
      param.setProvince("北京,天津,河北,山西,内蒙古,上海,江苏,浙江,山东,安徽,辽宁,吉林,黑龙江,湖北,湖南,河南,江西,广东,广西,海南,福建,四川,重庆,贵州,云南,西藏,陕西,甘肃,新疆,新疆兵团,青海,宁夏");
    }

    if (param.getVectorField() == null) {
      param.setVectorField("t");
    }
    if (param.getClusterKeywordsMode() == null) {
      param.setClusterKeywordsMode("k");
    }
    if (param.getClusterKeywords() == null) {
      param.setClusterKeywords(true);
    }
    if (param.getClusterVectors() == null) {
      param.setClusterVectors(true);
    }

    if (param.getLikeDegree() == null) {
      param.setLikeDegree(configService.getLikeDegree());
    }

    String uuid = StringUtils.getUUID();
    param.setUuid(uuid);
    if (param.getAggWeight() == null) {
      param.setAggWeight(0.55);
    }
    if (param.getMaxReadingSize() == null) {
      param.setMaxReadingSize(configService.getMaxReadSize());
    }

  }
}
